<!DOCTYPE html>
<html lang="en">
  <head>
      <meta charset="UTF-8">
      <title>Dom对象转成Jquery对象</title>
      <script type="text/javascript" src="script/jquery-3.6.0.min.js"></script>
      <script type="text/javascript" >
        window.onload = function() {
          //username就是dom对象
          var username = document.getElementById("username");
          alert("username value= " + username.value);

          //通过jquery获取输入框的value
          //把username的dom对象转成jquery对象
          var $username = $(username);
          //使用jquery的方法获取value
          alert("$username value=" + $username.val())
        }
      </script>
  </head>
  <body>
    用户名 <input type="text" id="username" name="username" value="lmy">
  </body>
</html>